<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function createPeople (name, age, gender){
            var obj = new Object();
            obj.name = name;
            obj.age = age;
            obj.gender = gender;
            obj.sayName = function (){
                document.write(this.name);
            };
            return obj;
        }
        var obj1 = createPeople("孙悟空", 18, "男");
        var obj2 = createPeople("白骨精", 15, "妖怪");
        var obj3 = createPeople("猪八戒", 25, "男");
        obj1.sayName();
        obj2.sayName();
        obj3.sayName();
    </script>
</head>
<body>
    
</body>
</html>